/**
 * Created by zycool on 2016/7/11.
 * 统计 - 非内检缺陷管理
 */


;(function($, window, document, undefined){

    var $form_01 = $('#JQ_form_01');
    var param = $form_01.serialize();
    DyyBase.ajax(DyyBase.url_noninternal_statistics(),param,function(dataset){
        if(dataset.bool){
            var data_temp = dataset.result;
            var count = 0;
            var span = '';
            for(var i = 0, len = data_temp.length; i < len; i++){
                count += parseInt(data_temp[i].NUM);
            }
            for(var j = 0, lens = data_temp.length; j < lens; j++){
                var percent = Math.round(parseInt(data_temp[j].NUM) / count * 10000) / 100.00;
                percent = percent + '%';
                span += '<p><span style="width: 34%">'+data_temp[j].TYPE+'</span><span style="width: 33%">'+data_temp[j].NUM+'</span><span style="width: 33%">'+percent+'</span></p>';
            }
            $('#JQ_statistics_body').empty().html(span);
            drawNoInspBar(dataset);
        }
    });

    // 返回
    $('#JQ_statistics_goback').click(function(){
        window.location.href = DyyBase.root_path+'/pbf/external/externalInspection.html';
    });

})(jQuery, window, document);